// pages/partnercenter/commission/commission.js
var shihan = require('../../../common/fetch')
var config = require('../../../common/config')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    bupiaoflag: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      commonimg: options.img,
      money: options.money
    })
    wx.setNavigationBarTitle({
      title: '赚' + options.money+'元佣金'
    })
    wx.hideShareMenu()
  },
  bupiaodetail: function () {//查看规则详情
    wx.navigateTo({
      url: '/pages/strategyinfo/strategyinfo?share=0&nologin=1&url=' + encodeURIComponent(config.commonurl + 'h5/partner/teamrulenew.html')
    })
  },
  closebupiao: function () {
    this.setData({
      bupiaoflag: false
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    var customerId = wx.getStorageSync('customerId'); 
    var url = encodeURIComponent(config.commonurl + 'h5/partner/invitation.html?partner_id=' + customerId);
    console.log(url)
    return {
      title: '【' + config.nickName + '】邀请你一起加入世瀚合伙人团队',
      path: '/pages/strategyinfo/strategyinfo?share=0&nologin=1&url=' + url + '&pid=' + customerId,
      imageUrl: 'https://img-oss.shihanbainian.com/shihan2/icon/small_routine/invitashare.jpg',
      success: function (res) {
        // 转发成功
      },
      fail: function (res) {
        // 转发失败
      }
    }
  }
})